package com.xc.h05.service.changlongfei.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xc.h05.entity.Course;
import com.xc.h05.entity.CoursePriceCLF;
import com.xc.h05.mapper.CourseMapper;
import com.xc.h05.service.changlongfei.OnlineCoursesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OnlineCoursesServiceImpl implements OnlineCoursesService {
    @Autowired
    CourseMapper courseMapper;
//综合
    @Override
    public PageInfo<Course> getCourseOrderBy(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return new PageInfo<>(courseMapper.selectCourseOrderBy());
    }
//人气
    @Override
    public PageInfo<Course> getCourseOrderByStudy(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return new PageInfo<>(courseMapper.selectCourseOrderByStudy());
    }
//价格（升序）
    @Override
    public PageInfo<Course> getCourseOrderByPrice(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return new PageInfo<>(courseMapper.selectCourseOrderByPrice());
    }
//价格（降序）
    @Override
    public PageInfo<Course> getCourseOrderByPriceDesc(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return new PageInfo<>(courseMapper.selectCourseOrderByPriceDesc());
    }
//价格动态
    @Override
    public PageInfo<Course> getCourseByPrice(int pageNum, int pageSize, CoursePriceCLF coursePriceCLF) {
        PageHelper.startPage(pageNum,pageSize);
        return new PageInfo<>(courseMapper.selectCourseByPrice(coursePriceCLF));
    }

}
